home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / ISR.SWG / 0007_RUNINBCK.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  61 lines

  1. {
  2. > How do you have a Procedure running Constantly While others things are
  3. > happening??
  4.  
  5. Well, to have them run at the exact same time isn't possible. You can swap
  6. back and forth pretty quick though. The basic idea is that when the
  7. computer is idle (waiting For a key, displaying a Text File, etc) you have
  8. it jump to your routine.
  9. }
  10. Program Test1;
  11. (* This will wait For a key and display the time *)
  12. Uses
  13.   Dos, Crt;
  14.  
  15. Procedure WriteTime;
  16. Var
  17.   CurX,
  18.   CurY,
  19.   CurA  : Byte;
  20.   H, M,
  21.   S, MS : Word;
  22. begin
  23.   CurX := WhereX;
  24.   CurY := WhereY;
  25.   CurA := TextAttr;
  26.   TextColor(7);
  27.   GotoXy(60, 1);
  28.   GetTime(H, M, S, MS);
  29.   Write(H, ':', M, ':', S, '.', MS);
  30.   TextAttr := CurA;
  31.   GotoXy(CurX, CurY);
  32. end;
  33.  
  34. { Uncomment this For Keyboard IDLE Demo }
  35. Var Ch : Char;
  36.     Done : Boolean;
  37. begin
  38.   Repeat
  39.     Repeat
  40.       WriteTime
  41.     Until KeyPressed;
  42.     Ch := ReadKey;
  43.     Done := (Ch = #27);
  44.   Until Done;
  45. end.
  46.  
  47. { Uncomment this For TextFile IDLE Demo }
  48. {
  49. Var T : Text;
  50.     Ts : String;
  51. begin
  52.   Assign(T,'BBS.NFO');
  53.   Reset(T);
  54.   While Not Eof(T) Do begin
  55.     ReadLn(T,Ts);
  56.     WriteTime;
  57.     WriteLn(Ts);
  58.   end;
  59.   Close(T);
  60. end.
  61. }